package masterjava.common.store;

import masterjava.common.io.IOUtil;

import java.io.File;
import java.util.Iterator;

/**
 * User: gkislin
 * Date: 8/4/11
 */
public class FileStore extends AdapterPropertiesStore {
    private final Property<File> propFile;

    public FileStore(final Property<File> propFile) {
        this.propFile = propFile;
    }

    @Override
    public String load(String key) {
        return IOUtil.loadFile(propFile.getValue());
    }

    @Override
    public void save(String key, String newValue) {
        IOUtil.saveFile(propFile.getValue(), newValue);
    }

    @Override
    public Iterator<String> getKeysIterator() {
        return null;
    }
}
